package com.yang.frost.blueberry.service;

import com.yang.frost.blueberry.domain.SysPermission;
import com.yang.frost.blueberry.domain.SysRolePermission;
import com.yang.frost.blueberry.enums.StateEnum;
import org.apache.commons.collections4.SetUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * @author 10296
 * @date 2021/1/25
 * @Description:
 */
public interface SysRolePermissionService {
    /**
     * 保存
     *
     * @param roleId        roleId
     * @param permissionIds ss
     * @return 1
     * @throws Exception e
     */
    int saveSysRolePermission(Long roleId, List<Long> permissionIds) throws Exception;

    /**
     * 根据roleId 查询权限Ids
     *
     * @param roleId roleId
     * @return 集合
     * @throws Exception e
     */
    List<Long> getPermissionIdsByRoleId(Long roleId) throws Exception;

    /**
     * 根据 roleId 查询
     *
     * @param roleId roleId
     * @return ""
     * @throws Exception e
     */
    List<Long> getThreeLevelPermissionIdsByRoleId(Long roleId) throws Exception;

    /**
     * 批量添加
     *
     * @param roleId roleId
     * @param addSet 批量添加
     * @return true
     */
    boolean saveSysRolePermissionBatch(Long roleId, SetUtils.SetView addSet);

    /**
     * 根据RoleId 删除
     *
     * @param roleId roleId
     * @return true false
     * @throws Exception e
     */
    boolean deleteSysRolePermissionByRoleId(Long roleId) throws Exception;

    /**
     * 根绝RoleId 查询权限
     *
     * @param roleId roleIf
     * @return ""
     * @throws Exception e
     */
    Set<String> getPermissionCodesByRoleId(Long roleId) throws Exception;

    /**
     * 判断权限是否存在
     *
     * @param permissionId id
     * @return ''
     * @throws Exception e
     */
    boolean isExistsByPermissionId(Long permissionId) throws Exception;

    /**
     * 判断 roleId是否有权限
     *
     * @param roleId roleId
     * @return ""
     * @throws Exception e
     */
    boolean hasPermission(Long roleId) throws Exception;

    /**
     * 根据用户ID查询菜单
     *
     * @param userId 用户ID
     * @return 菜单
     */
    List<SysPermission> getMenuTreeByUserId(String userId);

}
